package com.sgg.gulimall_product.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sgg.gulimall_common.api.Result;
import com.sgg.gulimall_product.generator.domain.PmsAttrGroup;
import com.sgg.gulimall_product.generator.service.PmsAttrGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/attrGroup")
public class PmsAttrGroupController {
    @Autowired
    private PmsAttrGroupService pmsAttrGroupService;

    @GetMapping("/{cateGoryId}")
    public Result getAttrGroupListByCategoryId(@PathVariable("cateGoryId") String cateGoryId){
        final List<PmsAttrGroup> list = pmsAttrGroupService.list(
                new LambdaQueryWrapper<PmsAttrGroup>()
                        .eq(PmsAttrGroup::getCatelogId, cateGoryId));
        return Result.success(list);
    }
}
